Skip to content

fix: add memberId filter to identity verification activity query (CM-1011)#4007

Merged
skwowet merged 1 commit intomainfrom
bugfix/CM-1011
Apr 7, 2026
Merged

fix: add memberId filter to identity verification activity query (CM-1011)#4007
skwowet merged 1 commit intomainfrom
bugfix/CM-1011

Conversation

@skwowet
Copy link
Copy Markdown
Collaborator

@skwowet skwowet commented Apr 7, 2026

Summary

  • The verifyMemberIdentity endpoint queries activityRelations (840M rows) by username and platform only — neither column is indexed, causing a full sequential scan and read timeouts
  • Adding memberId to the filter uses the existing ix_activityRelations_memberId index, reducing query cost from ~34.8M to ~53K (660x improvement)

Note

Low Risk
Low risk, narrowly scoped filter change to an internal count query; main impact is improved performance and reduced timeout risk when unverifying identities.

Overview
When verifyMemberIdentity is called with verified=false, the activityRelations existence check is now additionally filtered by memberId (alongside username and platform). This scopes the count query to the current member, allowing index usage and preventing slow full-table scans/timeouts before deciding to delete the identity vs. unmerge.

Reviewed by Cursor Bugbot for commit ee9943d. Bugbot is set up for automated code reviews on this repo. Configure here.

Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
@skwowet skwowet self-assigned this Apr 7, 2026
Copilot AI review requested due to automatic review settings April 7, 2026 10:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes the verifyMemberIdentity endpoint by ensuring the activityRelations lookup is filtered by memberId, allowing Postgres to use the existing ix_activityRelations_memberId index and avoid expensive scans on a very large table.

Changes:

  • Add memberId to the queryActivityRelations filter used when un-verifying a member identity.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@skwowet skwowet merged commit dc3b68a into main Apr 7, 2026
22 checks passed
@skwowet skwowet deleted the bugfix/CM-1011 branch April 7, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants